package client;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

import adapter.MouseAdapterMethod;


public class MouseAdatperClient {
	
	static JDialog dialog = null;
	
	public static void main(String[] args) {
		
		//main frame's view
		JFrame mainFrame = new JFrame("Mouseadapter client");
		mainFrame.setBounds(100, 100, 400, 300);
		JPanel panel = new JPanel();
		panel.setBounds(0, 0, 400, 300);
		JLabel messg = new JLabel("Check here");
		panel.add(messg);
		mainFrame.add(panel);
		mainFrame.setVisible(true);
				
		//dialog's view
		dialog = new JDialog(mainFrame,"Title");
		dialog.setBounds(120, 120, 200, 100);
		JPanel diaPanel = new JPanel();
		JLabel me = new JLabel("click success");
		diaPanel.add(me);
		dialog.add(diaPanel);
		
		//client use the adapter
		//add a listener for main frame
		MouseAdapterMethod iAdapter = new MouseAdapterMethod();
		panel.addMouseListener(iAdapter);
		
	}
	
	public static JDialog getDialog()
	{
		return dialog;
	}
}
